const filters={
  //格式化日期为“yyyy-MM-dd hh:mm:ss”
  formatDate:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    var seconds = time.getSeconds();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes) + ':' + rightTwo(seconds);
  },

  //格式化日期为“yyyy-MM-dd”
  formatDates:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date);
  },
  //格式化日期为“yyyy-MM”
  formatDatess:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    return year + '-' + rightTwo(month);
  },
//格式化日期为“yyyy-MM-dd hh:mm”
  formatDateo:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes);
  },
  //格式化日期为“yy-MM-dd hh:mm”
  formatDateo1:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes);
  },
  //格式化日期为“yyyyMM”
  formatDatesss:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    return year + rightTwo(month);
  },
   
     
}
export default filters;